<include file="public/layout" />
<style>
    .tab-content , .tab-content2{
        display: none;
        height: 350px;
        overflow:auto;
    }
    .btn{
        display: inline-block;
        background: #00a0e9;
        color:#FFFFFF;
        border-radius: 5px;
        padding: 5px;
        margin-left: 5px;
        cursor: default;
    }
</style>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>资产管理 - 编辑资产信息</h3>
                <h5>资产信息管理</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="handleposition" method="post">
        <input type="hidden" name="act" value="{$act}">
        <input type="hidden" name="id" value="{$info.id}">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="name"><em>*</em>资产名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="name" value="{$info.name}" id="name" class="input-txt" >
                    <span class="err" id="err_name"></span>
                    <p class="notic">设置资产名称</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="desc"><em>*</em>资产描述</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="desc" value="{$info.desc}" id="desc" class="input-txt" >
                    <span class="err" id="err_desc"></span>
                    <p class="notic">设置资产名称</p>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label for="sort"><em>*</em>排序值</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="sort" value="{$info.sort}" id="sort" class="input-txt" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" >
                    <span class="err" id="err_sort"></span>
                    <p class="notic">设置资产排序</p>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label>资产图标</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show">
            <span class="show">
                <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$info.image}">
                    <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src={$info.image}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                </a>
            </span>
            <span class="type-file-box">
                <input type="text" id="image" name="image" value="{$info.image}" class="type-file-text">
                <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                <input class="type-file-file" onClick="GetUploadify(1,'','category','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
            </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic">请上传图片格式文件</p>
                </dd>
            </dl>


            <div class="bot">
                <a href="JavaScript:void(0);" onclick="verifyForm()" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function verifyForm(){
        $('span.err').show();
        $.ajax({
            type: "POST",
            url: "{:U('Admin/World.World/walletHandle')}",
            data: $('#handleposition').serialize(),
            dataType: "json",
            error: function () {
                layer.alert("服务器繁忙, 请联系管理员!");
            },
            success: function (data) {
                if (data.status == 1) {
                    layer.msg(data.msg, {icon: 1});
                    setTimeout(function(){
                        location.href = "{:U('Admin/World.World/wallet_List')}"
                    },2000);
//                    location.href = "{:U('Admin/World.World/wallet_List')}";
                } else {
                    layer.msg(data.msg, {icon: 2});
                    $.each(data.result, function (index, item) {
                        $('#err_' + index).text(item).show();
                    });
                }
            }
        });
    }

    function img_call_back(fileurl_tmp)
    {
        $("#image").val(fileurl_tmp);
        $("#img_a").attr('href', fileurl_tmp);
        $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
    }
</script>
</body>
</html>